/*
 *  MouseJoint.h
 *  Squirrels
 *
 *  Created by Dmitry Fadeev on 9/22/11.
 *  Copyright 2011 Arello Mobile. All rights reserved.
 *
 */

#pragma once

#include <physics/Joint.h>
#include <physics/Registrator.h>
#include <physics/Types.h>
#include <physics/Node.h>

struct b2MouseJointDef;

namespace physics
{
	
	class MouseJoint : public Joint
	{
	PHYSICS_JOINT_REGISTER(MouseJoint)
		
	protected:
		virtual bool on_node(xml::Provider *prov, const std::string &name);
		
		b2MouseJointDef* GetJointDef() { return (b2MouseJointDef*) jointDef.get(); }
		
	public:
		MouseJoint(World *world);
		MouseJoint(World *world, Node * node,  Node * node2, const physics::Vector2 & target);
		virtual ~MouseJoint();
		
		void SetTarget(const physics::Vector2 & newTarget);
		physics::Vector2 GetTarget() const;
		
		void SetMaxForce(float force);
		float GetMaxForce() const;
	};
	
}